<!DOCTYPE html>
<html lang="zh" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="book">
<meta name="generator" content="Paradox, paradox-material-theme=0.6.0, mkdocs-material=3.0.3">

<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="">
<meta name="lang:search.pipeline.stopwords" content="true">
<meta name="lang:search.pipeline.trimmer" content="true">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">


<meta name="description" content="book">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<title>Akka HTTP 如何使得 Web 工作 · Scala Web 开发——基于Akka HTTP</title>
<link rel="stylesheet" href="../assets/stylesheets/application.451f80e5.css">
<link rel="stylesheet" href="../assets/stylesheets/application-palette.22915126.css">
<meta name="theme-color" content="#009688" />
<link rel="stylesheet" href="../lib/material__tabs/dist/mdc.tabs.min.css">
<link rel="stylesheet" href="../lib/prettify/prettify.css">
<script src="../assets/javascripts/modernizr.1aa3b519.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
<style>
body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}
code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}
</style>
<link rel="stylesheet" href="../assets/fonts/font-awesome.css">
<link rel="stylesheet" href="../assets/fonts/material-icons.css">
<link rel="stylesheet" href="../assets/stylesheets/paradox-material-theme.css">
</head>
<body
data-md-color-primary="teal"
data-md-color-accent="indigo"
>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="Scala Web 开发——基于Akka HTTP" class="md-header-nav__button md-logo">
<i class="md-icon">local_library</i>
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">
Scala Web 开发——基于Akka HTTP
</span>
<span class="md-header-nav__topic">
Akka HTTP 如何使得 Web 工作
</span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">&#xE5CD;</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>

</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/yangbajing/scala-web-development"
title="Go to repository"
class="md-source"
data-md-source="github">
<div class="md-source__icon">
<i class="fa fa-github"></i>
</div>
<div class="md-source__repository">
yangbajing/scala-web-development
</div>
</a>

</div>
</div>
</div>
</nav>
</header>

<div class="md-container">
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0" style="visibility: hidden">
<label class="md-nav__title md-nav__title--site" for="drawer">
<a href="../index.html" title="Scala Web 开发——基于Akka HTTP" class="md-nav__button md-logo">
<span class="md-nav__button md-logo">
<i class="md-icon">local_library</i>
</a>
<a href="../index.html" title="Scala Web 开发——基于Akka HTTP">
Scala Web 开发——基于Akka HTTP
</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/yangbajing/scala-web-development"
title="Go to repository"
class="md-source"
data-md-source="github">
<div class="md-source__icon">
<i class="fa fa-github"></i>
</div>
<div class="md-source__repository">
yangbajing/scala-web-development
</div>
</a>

</div>
<ul>
  <li><a href="../preface.html" class="page">前言</a></li>
  <li><a href="../env/index.html" class="page">Scala 环境配置</a>
  <ul>
    <li><a href="../env/env.1.html" class="page">Sbt</a></li>
    <li><a href="../env/env.2.html" class="page">IDE开发工具</a></li>
    <li><a href="../env/env.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../scala/index.html" class="page">Scala 语言基础</a>
  <ul>
    <li><a href="../scala/scala.0.html" class="page">REPL</a></li>
    <li><a href="../scala/scala.1.html" class="page">你好，Scala</a></li>
    <li><a href="../scala/scala.2.html" class="page">Scala基础</a></li>
    <li><a href="../scala/scala.3.html" class="page">流程和函数</a></li>
    <li><a href="../scala/scala.4.html" class="page">集合</a></li>
    <li><a href="../scala/scala.5.html" class="page">class和object</a></li>
    <li><a href="../scala/scala.6.html" class="page">函数式</a></li>
    <li><a href="../scala/scala.7.html" class="page">Trait</a></li>
    <li><a href="../scala/scala.8.html" class="page">并发</a></li>
    <li><a href="../scala/scala.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../basic/index.html" class="page">Akka HTTP 基础</a>
  <ul>
    <li><a href="../basic/basic.0.html" class="page">Akka HTTP 基础</a></li>
    <li><a href="../basic/basic.1.html" class="page">Web 工作方式</a></li>
    <li><a href="../basic/basic.2.html" class="page">使用 Akka Http 搭建一个简单的 Web 服务</a></li>
    <li><a href="../basic/basic.3.html" class="page">Akka HTTP 的通用抽象</a></li>
    <li><a href="../basic/basic.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../server-api/index.html" class="page">服务端API</a>
  <ul>
    <li><a href="../server-api/work.html" class="active page">Akka HTTP 如何使得 Web 工作</a></li>
    <li><a href="../server-api/advanced.html" class="page">高级服务端 API</a></li>
  </ul></li>
  <li><a href="../routing-dsl/index.html" class="page">路由DSL</a>
  <ul>
    <li><a href="../routing-dsl/route.html" class="page">Route 路由</a></li>
    <li><a href="../routing-dsl/directive.html" class="page">Directive 指令</a></li>
    <li><a href="../routing-dsl/custom-directive.html" class="page">自定义指令</a></li>
    <li><a href="../routing-dsl/rejections.html" class="page">拒绝 rejections</a></li>
    <li><a href="../routing-dsl/exception.html" class="page">异常处理</a></li>
    <li><a href="../routing-dsl/file-upload.html" class="page">实战：大文件断点上传、下载和秒传</a></li>
  </ul></li>
  <li><a href="../directives/index.html" class="page">常用指令</a>
  <ul>
    <li><a href="../directives/path.html" class="page">PathDirectives（路径指令）</a></li>
    <li><a href="../directives/method.html" class="page">directives/method.html</a></li>
    <li><a href="../directives/parameter_form.html" class="page">directives/parameter_form.html</a></li>
    <li><a href="../directives/marshalling.html" class="page">directives/marshalling.html</a></li>
    <li><a href="../directives/file.html" class="page">directives/file.html</a></li>
    <li><a href="../directives/cookie.html" class="page">directives/cookie.html</a></li>
  </ul></li>
  <li><a href="../data/index.html" class="page">数据</a>
  <ul>
    <li><a href="../data/data.0.html" class="page">数据</a></li>
    <li><a href="../data/data.1.html" class="page">JSON</a></li>
    <li><a href="../data/data.ant-design-pro.html" class="page">实战：为Ant Design Pro提供后端接口</a></li>
    <li><a href="../data/data.kryo.html" class="page">Kryo</a></li>
    <li><a href="../data/data.2.html" class="page">Protobuf</a></li>
    <li><a href="../data/data.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../test/index.html" class="page">测试</a>
  <ul>
    <li><a href="../test/test.0.html" class="page">测试</a></li>
    <li><a href="../test/test.1.html" class="page">Scalatest</a></li>
    <li><a href="../test/test.2.html" class="page">测试异步代码</a></li>
    <li><a href="../test/test.3.html" class="page">端到端测试Route</a></li>
    <li><a href="../test/test.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../actor/index.html" class="page">Akka Actor</a>
  <ul>
    <li><a href="../actor/actor.html" class="page">Akka Typed Actor</a></li>
    <li><a href="../actor/actor-test.html" class="page">Akka Actor 测试</a></li>
    <li><a href="../actor/actor.z.html" class="page">Actor小结</a></li>
  </ul></li>
  <li><a href="../oauth/index.html" class="page">实战：实现OAuth 2服务</a>
  <ul>
    <li><a href="../oauth/oauth.0.html" class="page">实战：OAuth 2 服务</a></li>
    <li><a href="../oauth/oauth.1.html" class="page">OAuth 2简介</a></li>
    <li><a href="../oauth/oauth.2.html" class="page">OAuth 2接口设计</a></li>
    <li><a href="../oauth/oauth.3.html" class="page">OAuth 2服务实现</a></li>
    <li><a href="../oauth/oauth.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../database/index.html" class="page">访问数据库</a>
  <ul>
    <li><a href="../database/database.0.html" class="page">访问数据库</a></li>
    <li><a href="../database/database.1.html" class="page">使用 JDBC 访问 PostgreSQL</a></li>
    <li><a href="../database/database.2.html" class="page">使用 Slick 访问数据库</a></li>
    <li><a href="../database/database.3.html" class="page">访问 Cassandra 数据库</a></li>
    <li><a href="../database/database.4.html" class="page">访问 Redis</a></li>
    <li><a href="../database/database.5.html" class="page">访问 Elasticsearch</a></li>
    <li><a href="../database/database.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../engineering/index.html" class="page">工程化</a>
  <ul>
    <li><a href="../engineering/swagger.html" class="page">使用Swagger编写API文档</a></li>
    <li><a href="../engineering/guice.html" class="page">使用Guice管理类依赖</a></li>
  </ul></li>
  <li><a href="../grpc/index.html" class="page">Akka gRPC</a>
  <ul>
    <li><a href="../grpc/grpc.html" class="page">gRPC服务</a></li>
    <li><a href="../grpc/build-tool.html" class="page">构建工具</a></li>
    <li><a href="../grpc/deployment.html" class="page">部署</a></li>
    <li><a href="../grpc/grpc.z.html" class="page">小结</a></li>
  </ul></li>
  <li><a href="../config-discovery/index.html" class="page">实战：配置管理、服务发现系统</a></li>
  <li><a href="../appendix/index.html" class="page">附录</a>
  <ul>
    <li><a href="../appendix/appendix.0.html" class="page">参考资料</a></li>
    <li><a href="../appendix/appendix.1.html" class="page">专业术语</a></li>
    <li><a href="../appendix/appendix.2.html" class="page">词汇表</a></li>
  </ul></li>
  <li><a href="../donate.html" class="page">赞助</a></li>
</ul>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Table of contents</label>
<ul>
  <li><a href="../server-api/work.html#akka-http-如何使得-web-工作" class="header">Akka HTTP 如何使得 Web 工作</a>
  <ul>
    <li><a href="../server-api/work.html#启动和停止" class="header">启动和停止</a></li>
    <li><a href="../server-api/work.html#请求-响应生命周期" class="header">请求、响应生命周期</a></li>
    <li><a href="../server-api/work.html#错误处理" class="header">错误处理</a></li>
  </ul></li>
</ul>
</nav>

</nav>
<ul style="display: none">
<li class="md-nav__item md-version" id="project.version">
<label class="md-nav__link" for="__version">
<i class="md-icon" title="Version">label_outline</i> 1.0.0
</label>
</li>
</ul>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="__toc">Table of contents</label>
<ul>
  <li><a href="../server-api/work.html#akka-http-如何使得-web-工作" class="header">Akka HTTP 如何使得 Web 工作</a>
  <ul>
    <li><a href="../server-api/work.html#启动和停止" class="header">启动和停止</a></li>
    <li><a href="../server-api/work.html#请求-响应生命周期" class="header">请求、响应生命周期</a></li>
    <li><a href="../server-api/work.html#错误处理" class="header">错误处理</a></li>
  </ul></li>
</ul>
</nav>

</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<div class="md-content__searchable">
<h1><a href="#akka-http-如何使得-web-工作" name="akka-http-如何使得-web-工作" class="anchor"><span class="anchor-link"></span></a>Akka HTTP 如何使得 Web 工作</h1>
<p>Akka HTTP 有 <strong>Low-Level</strong> 和 <strong>High-Level</strong> 两套服务端 API，这里我们来看看 <strong>Low-Level</strong> API，这会使你对 Akka HTTP 是怎样运行会 有一个深入的认识。</p>
<p>Akka HTTP 提供了一个基于 Reactive-Streams (反映式流)，全异步的 HTTP/1.1 服务端实现，支持以下特性：</p>
<ul>
  <li>完整支持 HTTP 持久化连接</li>
  <li>完整支持 HTTP 流水线</li>
  <li>完整支持异步 HTTP 流，包括 &ldquo;chunked&rdquo; （分块的）编码</li>
  <li>SSL/TLS 加密支持</li>
  <li>WebSocket 支持</li>
</ul>
<p>Akka HTTP 服务端组件有两层：</p>
<ol>
  <li><code>akka-http-core</code>：基本的低级API实现，提供了更偏底层的 HTTP 功能</li>
  <li><code>akka-http</code>：高级API实现，提供了易用的DSL（Directives）</li>
</ol>
<p><strong>low-level</strong> 聚焦于提供实现完整 HTTP/1.1 协议的基本功能：</p>
<ul>
  <li>连接管理</li>
  <li>解析和渲染“消息”及 headers</li>
  <li>超时管理（请求连接和服务端 accept 连接）</li>
  <li>响应顺序（透明的流水线 (pipeline) 支持）</li>
</ul>
<p>所有的非核心功能都放到了 <code>akka-http</code> 模块，如：路由、文件处理、压缩等等）。</p>
<h2><a href="#启动和停止" name="启动和停止" class="anchor"><span class="anchor-link"></span></a>启动和停止</h2>
<p>Akka HTTP 提供了 <code>bind</code> 这个方法来启动服务，它通过指定 <code>interface</code> 和 <code>port</code> 来绑定服务，并注册处理函数来处理进入的 HTTP 连接。</p>
<pre class="prettyprint"><code class="language-scala">import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.stream.Materializer
import akka.stream.scaladsl._

implicit val system = ActorSystem()
implicit val materializer = Materializer(system)
implicit val executionContext = system.dispatcher

val serverSource: Source[Http.IncomingConnection, Future[Http.ServerBinding]] =
  Http().bind(interface = &quot;localhost&quot;, port = 8080)
val bindingFuture: Future[Http.ServerBinding] =
  serverSource.to(Sink.foreach { connection =&gt; // foreach materializes the source
    println(&quot;Accepted new connection from &quot; + connection.remoteAddress)
    // ... and then actually handle the connection
  }).run()
</code></pre>
<p><code>Http.ServerBinding</code> 实例有一个 <code>unbind()</code> 方法，通过它可以停止 Akka HTTP 服务。</p>
<h2><a href="#请求-响应生命周期" name="请求-响应生命周期" class="anchor"><span class="anchor-link"></span></a>请求、响应生命周期</h2>
<p>低级别的 Akka HTTP 服务端 API 在 <code>akka-http-core</code> 模块提供了 <code>HttpRequest</code> 来接受多个或单个连接，并由 <code>HttpResponse</code> 生成响应。处理这 些请求/响应的函数调用类型叫做：<code>Flow[HttpRequest, HttpResponse, _]</code> ，由它来“转换” <strong>请求（HttpRequest）</strong> 到 <strong>响应（HttpResponse）</strong> 。</p>
<p>收到的 HTTP 请求通过调用 <code>handleWithXXX</code> 中的一个来处理，主要的方法有：</p>
<blockquote>
  <ul>
    <li><code>Flow[HttpRequest, HttpResponse, _]</code> 由 <code>handleWith</code> 方法使用</li>
    <li><code>HttpRequest =&gt; HttpResponse</code> 函数由 <code>handleWithSyncHandler</code> 方法使用</li>
    <li><code>HttpRequest =&gt; Future[HttpResponse]</code> 函数由 <code>handleWithAsyncHandler</code> 方法使用</li>
  </ul>
</blockquote>
<p>一个 <code>HttpRequest =&gt; HttpResponse</code> 函数的例子如下：</p>
<pre class="prettyprint"><code class="language-scala">val requestHandler: HttpRequest =&gt; HttpResponse = {
  case HttpRequest(GET, Uri.Path(&quot;/&quot;), _, _, _) =&gt;
    HttpResponse(entity = HttpEntity(
      ContentTypes.`text/html(UTF-8)`,
      &quot;&lt;html&gt;&lt;body&gt;Hello world!&lt;/body&gt;&lt;/html&gt;&quot;))

  case HttpRequest(GET, Uri.Path(&quot;/ping&quot;), _, _, _) =&gt;
    HttpResponse(entity = &quot;PONG!&quot;)

  case HttpRequest(GET, Uri.Path(&quot;/crash&quot;), _, _, _) =&gt;
    sys.error(&quot;BOOM!&quot;)

  case r: HttpRequest =&gt;
    r.discardEntityBytes() // important to drain incoming HTTP Entity stream
    HttpResponse(404, entity = &quot;Unknown resource!&quot;)
}

val bindingFuture: Future[Http.ServerBinding] =
  serverSource.to(Sink.foreach { connection =&gt;
    println(&quot;Accepted new connection from &quot; + connection.remoteAddress)

    connection handleWithSyncHandler requestHandler
    // this is equivalent to
    // connection handleWith { Flow[HttpRequest] map requestHandler }
  }).run()
</code></pre>
<p>在这个例子里，一个请求被 <code>HttpRequest =&gt; HttpResponse</code> 函数处理，使用 <code>handleWithSyncHandler</code> 来绑定了这一系列转换操作（等价于 Akka Stream 的 <code>map</code> 操作）。</p>
<h2><a href="#错误处理" name="错误处理" class="anchor"><span class="anchor-link"></span></a>错误处理</h2>
<p>在 Akka HTTP 服务初始化和运行中可能有各种各样的故障或错误情况发生。Akka 默认记录下了所有这些错误，但有时候需要自行处理这些错误，如：记录错误 发生的情况，关闭 <strong>Actor系统</strong>，或通知一些外部的监控端点……</p>
<p>有很多情况会造成在创建和实现一个服务时错误，有各种类型的错误，常见的包括：</p>
<ul>
  <li><code>bind</code> 到指定 address/port 失败。</li>
  <li>接受新的 <code>IncommingConnection</code> 时失败，如操作系统可打开文件描述符已用完或内存不足。</li>
  <li>处理一个连接时错误，如传入的请求数据无效。</li>
</ul>
<p>下面介绍下常见的故障情况及怎样处理这些故障。</p>
<h3><a href="#绑定失败-bind-failures-" name="绑定失败-bind-failures-" class="anchor"><span class="anchor-link"></span></a>绑定失败 (Bind failures)</h3>
<pre class="prettyprint"><code class="language-scala">val serverSource = Http().bind(&quot;localhost&quot;, 80)

val bindingFuture: Future[ServerBinding] = serverSource
  .to(handleConnections) // Sink[Http.IncomingConnection, _]
  .run()

bindingFuture.failed.foreach { ex =&gt;
  log.error(ex, &quot;Failed to bind to {}:{}!&quot;, &quot;localhost&quot;, 80)
}
</code></pre>
<p>当 <code>bind</code> 到 80 端口时，很有可能程序没有权限（需要 <code>root</code> 权限才能绑定到 80 端口），或者端口已被其它程序占用……这时就会发生**绑定故障**。上 面例子里，<code>bindingFuture</code> 将立即失败，我们可以监听 <code>onFaliure</code> 函数对指定的异常做出处理。</p>
<h3><a href="#连接源失败-connection-source-failures-" name="连接源失败-connection-source-failures-" class="anchor"><span class="anchor-link"></span></a>连接源失败 (Connection Source failures)</h3>
<p>下面的例子，我们通过一个 <code>failureMonitor</code> actor来捕获 <code>IncomingConnection</code> 错误，由 Actor 来处理这个错误，也许它会决定重启服务或关闭整个 <strong>ActorSystem</strong>　。</p>
<pre class="prettyprint"><code class="language-scala">val failureMonitor: ActorRef = system.actorOf(MyExampleMonitoringActor.props)

val reactToTopLevelFailures = Flow[IncomingConnection]
  .watchTermination()((_, termination) =&gt; termination.failed.foreach { cause =&gt;
    failureMonitor ! cause
  })

serverSource
  .via(reactToTopLevelFailures)
  .to(handleConnections) // Sink[Http.IncomingConnection, _]
  .run()
</code></pre>
<h3><a href="#连接失败-connection-failures-" name="连接失败-connection-failures-" class="anchor"><span class="anchor-link"></span></a>连接失败 (Connection failures)</h3>
<p>故障发生的第3种情况是连接已经建立，但在响应前突然终止，如：client中止了底层的TCP连接。这里此类故障可以使用与前一个相似的处理方式，但是我们将这个应用这个连接的处理流程中。</p>
<pre class="prettyprint"><code class="language-scala">val reactToConnectionFailure = Flow[HttpRequest]
  .recover[HttpRequest] {
    case ex =&gt;
      // handle the failure somehow
      throw ex
  }

val httpEcho = Flow[HttpRequest]
  .via(reactToConnectionFailure)
  .map { request =&gt;
    // simple streaming (!) &quot;echo&quot; response:
    HttpResponse(entity = HttpEntity(ContentTypes.`text/plain(UTF-8)`, request.entity.dataBytes))
  }

serverSource
  .runForeach { con =&gt;
    con.handleWith(httpEcho)
  }
</code></pre>
<p>大部分时间你都不需要深入理解这个故障处理，Akka 详细的记录了这些故障日志，并有一系列默认的方式来处理这些故障。</p>
</div>
<div>
<a href="https://github.com/yangbajing/scala-web-development/tree/master/book/src/main/paradox/server-api/work.md" title="Edit this page" class="md-source-file md-edit">
Edit this page
</a>
</div>
<div class="print-only">
<span class="md-source-file md-version">
1.0.0
</span>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="../server-api/index.html" title="服务端API" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
服务端API
</span>
</div>
</a>
<a href="../server-api/advanced.html" title="高级服务端 API" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
高级服务端 API
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
Powered by
<a href="https://github.com/lightbend/paradox">Paradox</a>
and
<a href="https://jonas.github.io/paradox-material-theme/">Paradox Material Theme</a>

</div>
<div class="md-footer-social">
<a href="https://github.com/yangbajing" class="md-footer-social__link fa fa-github"></a><a href="https://weibo.com/yangbajing" class="md-footer-social__link fa fa-globe"></a><a href="https://www.yangbajing.me/" class="md-footer-social__link fa fa-globe"></a>
</div>

</div>
</div>
</footer>

</div>
<script src="../assets/javascripts/application.583bbe55.js"></script>
<script src="../assets/javascripts/paradox-material-theme.js"></script>
<script>app.initialize({version:"0.17",url:{base:"../."}})</script>
<script type="text/javascript" src="../lib/prettify/prettify.js"></script>
<script type="text/javascript" src="../lib/prettify/lang-scala.js"></script>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
window.prettyPrint && prettyPrint();
});
</script>
</body>
</html>
